<template>
  <aplayer :audio="audio" fixed  ref="audioplay"  />
</template>

<script>
import newlistbus from "@/utils/bus/newlistbus";
export default {
  data() {
    return {
      song: {},
      audio: [],
      isShow: true,
    };
  },
  created() {
    this.audio = []
  },
  mounted() {
    setTimeout(() => {
      newlistbus.$on("audioDetails", (res) => {
      this.song = res;
      console.log(res);
    });
    }, 5);
  },
  methods: {},
  watch: {
    // "newlistbus.$on":{
    //   handler(v){
    //     console.log(v);
    //   }
    // },
    song(newValue) {
      this.audio.unshift(newValue);
    },
    audio(oldValue) {
      if(oldValue == null){
        this.isShow = false
      }
      if (oldValue.length > 10) {
        oldValue.shift();
      }
    },
    deep: true,
  },
  beforeDestroy() {
    this.audio = [];  
  },
};
</script>
<style scoped lang='less'>
</style>